package controller;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mongodb.BasicDBObject;
import com.mongodb.DBCollection;
import com.mongodb.DBObject;

import data.Data;

public class ShowInvoiceServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		
		String invoice = req.getParameter("invoice");
		
		if(invoice!=null)
		{
			DBCollection collection = Data.data("pay");
			DBObject object = collection.findOne(new BasicDBObject("invoice",invoice));
			req.setAttribute("object", object);
		}
		
		try {
			req.getRequestDispatcher("show_invoice.jsp").forward(req, resp);
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}
